package agu.misc;

import android.text.Editable;
import android.text.TextWatcher;
import androidx.core.util.Consumer;

public class TextWatcher2 implements TextWatcher
{
    Consumer<CharSequence> consumer;

    public TextWatcher2(Consumer<CharSequence> consumer){
        this.consumer = consumer;
    }

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after){
    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count){
    }

    @Override
    public void afterTextChanged(Editable s){
        if(consumer != null) consumer.accept(s);
    }
}
